import {request} from './request'
import {DelPatchListData, SearchModelData} from '../entityapi/base'
import {CameraListData} from '../entityapi/base'
// 获取数据，通过
export function getCameraListAPI(searchModel: SearchModelData) {
    return request({
        url: '/CameraList/getCameraList',//此处为自己请求地址
        method: 'get',
        params:{//传参数对应param接收
            currentPage: searchModel.currentPage,
            pageSize: searchModel.pageSize,
            cameraName: searchModel.cameraName,
            orgName: searchModel.orgName
        }
    })
}

export function getCameraListArrayAPI() {
    return request({
        url: '/MainPage/getMainPageCameraList',//此处为自己请求地址
        method: 'get',
    })
}

//add
export function addCameraInfoAPI(cameraListData: CameraListData) {
    return request({
        url: '/CameraList/add_camera',//此处为自己请求地址
        method: 'post',
        data:cameraListData//data是传对象，对应body接收
    })
}
//uodate
//add
export function updateCameraInfoAPI(cameraListData: CameraListData) {
    return request({
        url: '/CameraList/update_camera',//此处为自己请求地址
        method: 'post',
        data:cameraListData//data是传对象，对应body接收
    })
}
//del,看看要id还是什么，先传对象
export function delCameraInfoAPI(delPatchList: DelPatchListData) {
    return request({
        url: '/CameraList/delete_camera',//此处为自己请求地址
        method: 'post',
        data:delPatchList
    })
}
//history
//add
export function historyStreamAPI(id: number,beginTime:string , endTime: string ) {
    return request({
        url: '/CameraList/analysis_video',//此处为自己请求地址
        method: 'post',
        params:{
            id:id,
            beginTime:beginTime,
            endTime:endTime
        }
    })
}

//根据id获取rtsp实时流
export function getRtspById(id: number) {
    return request({
        url: '/MainPage/getMainPageURL',//此处为自己请求地址
        method: 'get',
        params:{
            id:id,
        }
    })
}
//开关实时流
export function switchIsPlayA(id: number,is_play: boolean){
    return request({
        url: '/CameraList/switch_is_play',//此处为自己请求地址
        method: 'post',
        params:{//传参数对应param接收
            id: id,
            is_play: is_play,
        }
    })
}
//开关历史流
export function switchIsHisPlayA(id: number,is_his_play: boolean){
    return request({
        url: '/CameraList/switch_is_his_play',//此处为自己请求地址
        method: 'post',
        params:{//传参数对应param接收
            id: id,
            is_his_play: is_his_play,
        }
    })
}